package concurrency;

/**
 * Created by sunzhengjie on 2017/1/18.
 */
public class TestGetLock {
    volatile int value = 100;

    public int getValue(){
        synchronized (TestGetLock.class){
            return value;
        }
    }

    public static void main(String[] arg0) throws InterruptedException {
        TestGetLock getLock = new TestGetLock();
        new Thread(){
            {setDaemon(true);}
            @Override
            public void run(){
                System.out.println(getLock.getValue());
            }
        }.start();
        Thread.sleep(100);
    }
}
